package com.chat.api.web.dao;


import com.chat.api.web.po.RemarkBean;
import com.chat.api.common.BaseRepo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RemarkRepo extends BaseRepo<RemarkBean,Long> {

    @Query(value = "select * from remark where rr_id = 0 and blog_id = 0",nativeQuery = true)
    List<RemarkBean> findAllSort();

    @Query(value = "select * from remark where rr_id = ?1",nativeQuery = true)
    List<RemarkBean> findRemarkList(Long id);

    @Query(value = "select * from remark where rr_id = 0 and blog_id = ?1",nativeQuery = true)
    List<RemarkBean> findAllSortByBlogId(Long blogId);

    @Query(value = "select count(*) from remark where blog_id = 0",nativeQuery = true)
    Integer getBlogRemarkCount();
}
